import { DirectionDefine } from '../base/Tool/ScreenTool';
import QuickTool from '../base/Tool/QuickTool';
import ArrayTool from '../base/Tool/ArrayTool';
export default class Game06_Data {

    countdown = 0.5
    tipsDealy = 5
    targetRate = 0.6
    speed = 0.5
    canMissRate = 0.3
    canErrorCount = 1
    timeLimit = 60

    targetGroup: Game06_Group = null;
    disturbGroups: Game06_Group[] = null;
    useColors = new Array<any>();

    createGroup () {
        let AllSuits = ArrayTool.copy(Game06_Suits.allSuits)
        let allPoints = ArrayTool.copy(Game06_Suits.allPoints)
        let allColors = ArrayTool.copy(Game06_Suits.allColors)

        this.targetGroup = new Game06_Group()
        this.targetGroup.suits = ArrayTool.randomAndPop(AllSuits)
        this.targetGroup.point = ArrayTool.randomAndPop(allPoints)
        this.targetGroup.color = ArrayTool.randomAndPop(allColors)
        this.useColors.push(this.targetGroup.color)

        this.disturbGroups = new Array<Game06_Group>()
        for (let i=0;i<3;i++) {
            let g = new Game06_Group()
            g.color = ArrayTool.randomAndPop(allColors)
            this.disturbGroups.push(g)
            this.useColors.push(g.color)
        }

        // console.log(this);
    }
}

export class Game06_Group {
    suits = -1
    point: string = null
    color: any = null;
}

export class Game06_CreateInfo {
    s0Pos: cc.Vec2;
    w = 78 * 2;
    h = 200;
    interval = 30;
    direction = DirectionDefine.right;

    getPosition(index) {
        if (index == 0) return this.s0Pos
        
        if (this.direction == DirectionDefine.right) {
            return cc.v2(this.s0Pos.x + (index * this.w) + (index) *this.interval, this.s0Pos.y)
        }else if (this.direction == DirectionDefine.left) {
            return cc.v2(this.s0Pos.x - (index * this.w) - (index) *this.interval, this.s0Pos.y)

        }else if (this.direction == DirectionDefine.top) {
            return cc.v2(this.s0Pos.x, this.s0Pos.y + (index * this.h) + (index) *this.interval)

        }else if (this.direction == DirectionDefine.bottom) {
            return cc.v2(this.s0Pos.x, this.s0Pos.y - (index * this.h) - (index) *this.interval)
        }
    }


    static createOne (index, d): Game06_CreateInfo {
        let info = new Game06_CreateInfo()
        info.direction = d
        if (d == DirectionDefine.right) {
            info.s0Pos = cc.v2(-QuickTool.winsc.width/2-info.w/2-info.interval/2, 350 - (index*info.h) - (index*info.interval))

        }else if (d == DirectionDefine.left) {
            info.s0Pos = cc.v2(QuickTool.winsc.width/2+info.w/2+info.interval/2, 350 - (index*info.h) - (index*info.interval))

        }else if (d == DirectionDefine.top) {
            info.s0Pos = cc.v2(-QuickTool.winsc.width/2 + info.interval/2 + info.w/2 + index * (info.w+info.interval), -info.h * 2 - info.h/2 - info.interval*2.5)

        }else if (d == DirectionDefine.bottom) {
            info.s0Pos = cc.v2(-QuickTool.winsc.width/2 + info.interval/2 + info.w/2 + index * (info.w+info.interval), info.h * 2 + info.h/2 + info.interval*2.5)
        }

        return info
    }
}

//即黑桃（spade）、红桃（heart）、梅花（club）、方块（dianmond），
export class Game06_Suits {
    static spade =0;
    static heart =1;
    static club =2;
    static dianmod =3;

    static allSuits = [Game06_Suits.spade, Game06_Suits.heart, Game06_Suits.club, Game06_Suits.dianmod]
    static allPoints = "A,1,2,3,4,5,6,7,8,9,10,J,Q,K".split(",")
    static allColors = [{color:cc.color(201, 77, 108), name:"粉色"}, //ok
    {color:cc.color(143, 77, 191), name:"紫色"}, //ok
    {color:cc.color(75, 148, 133), name:"青色"},  //ok
    {color:cc.color(237, 122, 59), name:"橙色"},  //ok
    {color:cc.color(235, 197, 19), name:"黄色"},  //ok
    {color:cc.color(121, 186, 74), name:"绿色"},  //ok
    {color:cc.color(81, 106, 194), name:"蓝色"}]  //ok

    static getDisplay (s: number){
        switch (s) {
            case this.spade: return "桃心"
            case this.heart: return "红桃"
            case this.club: return "梅花"
            case this.dianmod: return "方块"
        }

        return "-"
    }
}

/**
 * public void NOSomethingA()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingB()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingC()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingD()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingE()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingF()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingG()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingH()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingI()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingJ()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingK()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingL()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingM()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingN()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingO()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingP()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingQ()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingR()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingS()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingT()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingU()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingV()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
 */
